const axios = require('axios');
const { getAccessToken } = require('./accessToken')

async function customerServiceController(openid, content) {
  const access_token = await getAccessToken()
  const url = `https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=${access_token}`

  // 客服接口-发消息
  await axios.post(url, {
    touser: openid,
    msgtype: 'text',
    text: {
      content
    }
  })
}

module.exports = customerServiceController